package cn.doitedu.day02

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object T09_UnionDemo {

  def main(args: Array[String]): Unit = {

    //1.创建SparkConf
    val conf = new SparkConf().setAppName("MapPartitionsWithIndexDemo")
      .setMaster("local[4]")

    //2.创建SparkContext
    val sc = new SparkContext(conf)

    val rdd1 = sc.parallelize(List(1, 2, 3, 5), 2)
    val rdd2 = sc.parallelize(List(5, 6, 7, 8, 9, 10), 3)

    val rdd3: RDD[Int] = rdd1.union(rdd2)

    rdd3.saveAsTextFile("out/out13")
  }

}